<template>
  <div class="container">
    <el-form ref="form" :model="listQuery" label-width="80px">
      <el-form-item label="门店名">
        <el-input v-model="listQuery.name" :disabled="true"></el-input>
      </el-form-item>
      <el-form-item label="电话">
        <el-input v-model="listQuery.phone" :disabled="true"></el-input>
      </el-form-item>
      <el-form-item label="营业时间">
        <el-input v-model="listQuery.time" :disabled="true"></el-input>
      </el-form-item>
      <el-form-item label="地址">
        <el-input v-model="listQuery.address" :disabled="true"></el-input>
      </el-form-item>
      <el-form-item label="评分">
        <el-input v-model="listQuery.score" :disabled="true"></el-input>
      </el-form-item>
      <el-form-item label="门店描述">
        <el-input v-model="listQuery.describe"  :disabled="true"></el-input>
      </el-form-item>
      <el-form-item label="门店状态">
        <el-select v-model="listQuery.isFlag" placeholder="请选择活动区域">
          <el-option label="申请中" value="0"></el-option>
          <el-option label="已通过" value="1"></el-option>
          <el-option label="未通过" value="2"></el-option>
        </el-select>
      </el-form-item>
      <el-form-item>
        <el-button type="primary" @click="updateSudent">点击完成</el-button>
      </el-form-item>
    </el-form>
  </div>
</template>

<script>
import { putshopDoors } from "@/api/apply";
export default {
  data() {
    return {
      listQuery: {
        name: "",
        phone: "",
        time: "",
        address: "",
        score: "",
        describe: "",
        isFlag: "",
      },
    };
  },
  created() {
    // 如果是跳转来的，则接受初始化参数
    if (this.$route.query) {
      this.listQuery = this.$route.query.data;
      if (this.listQuery.isFlag == 0) {
        this.listQuery.isFlag = "申请中";
      }
      if (this.listQuery.isFlag == 1) {
        this.listQuery.isFlag = "已通过";
      }
      if (this.listQuery.isFlag == 2) {
        this.listQuery.isFlag = "未通过";
      }
    }
  },
  methods: {
    updateSudent() {
      putshopDoors(this.listQuery._id, this.listQuery);
      this.$router.push({ name: "informationw" });
    },
  },
};
</script>

<style scoped>
.container {
  margin: 25px auto;
  width: 800px;
}
</style>